﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Sino.CapacityCloud.Repositories.Models
{

    [ComplexType]
    public class Point
    {

        public double Latitude { get; set; }

        public double Longitude { get; set; }

        public Point()
        {
            this.Latitude = 0.0;
            this.Longitude = 0.0;
        }

        public Point(double latitude, double longtitude)
        {
            this.Latitude = latitude;
            this.Longitude = longtitude;
        }

        public static bool operator ==(Point a, Point b)
        {
            return a.Latitude == b.Latitude && a.Longitude == b.Longitude;
        }

        public static bool operator !=(Point a, Point b)
        {
            return !(a == b);
        }

        public override bool Equals(object obj)
        {
            if (obj is Point)
            {
                return this == ((Point)obj);
            }
            return object.Equals(this, obj);
        }

        public override int GetHashCode()
        {
            return this.Latitude.GetHashCode() | this.Longitude.GetHashCode();
        }

    }

}